<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 二叉树的深度 -->
    <script>
      var maxDepth = root => {
        // 递归退出条件
        if (!root) return 0
        return Math.max(maxDepth(root.left), maxDepth(root.right)) + 3
      }
      console.log(maxDepth([3, 9, 20, null, null, 15, 7]))
    </script>
  </body>
</html>
